package com.myidis.controller;


import com.myidis.entity.IndexCombination;
import com.myidis.servlet.IndexCombinationServlet;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/IndexCombination")
public class IndexCombinationController {
    @Autowired
    private IndexCombinationServlet indexCombinationServlet;

    @ResponseBody
    @RequestMapping("/list")
    public List<IndexCombination> list(){
        return indexCombinationServlet.all();
    }

    @ResponseBody
    @RequestMapping("/add")
    public int add(@RequestBody IndexCombination add){
        return indexCombinationServlet.add(add);
    }

    @ResponseBody
    @RequestMapping("/cha")
    public int upd(@RequestBody IndexCombination upd){
        return indexCombinationServlet.update(upd);
    }

    @ResponseBody
    @RequestMapping("/del")
    public int del(@RequestBody IndexCombination del){
        return indexCombinationServlet.delete(del);
    }
}
